package com.example.frag;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;

public class fragment extends Fragment {

    private Button button1;
    private Button button2;
    private Button button3;

    public fragment(){
        super(R.layout.wanglo);
    }

    @Override
    public void onViewCreated(@NonNull View view,@NonNull Bundle savedInstanceState){
        super.onViewCreated(view,savedInstanceState);

        button1=getView().findViewById(R.id.button1);
        button1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent();
                intent.setAction("android.intent.action.VIEW");
                intent.setData(Uri.parse("http://www.hzu.edu.cn"));
                startActivity(intent);
            }
        });

        button2=getView().findViewById(R.id.button2);
        button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=getActivity().getPackageManager().getLaunchIntentForPackage("com.tencent.mm");
                startActivity(intent);
            }
        });

        button3=getView().findViewById(R.id.button3);
        button3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=getActivity().getPackageManager().getLaunchIntentForPackage("com.tencent.mobileqq");
                startActivity(intent);
           }
        });
    }



}
